//
//  NSURLSessionTask+CLQ.m
//  rxtd_xsd
//
//  Created by clq on 15/9/21.
//  Copyright © 2015年 rxtd. All rights reserved.
//

#import "NSURLSessionTask+CLQ.h"

char* const ASSOCIATION_PARALLEL_PROCCESS = "ASSOCIATION_PARALLEL_PROCCESS";
char* const ASSOCIATION_REQUEST_INDEX = "ASSOCIATION_REQUEST_INDEX";

@implementation NSURLSessionTask (CLQ)

#pragma mark -set/get Attribute
-(void) setParallelProccess:(BOOL)parallelProccess
{
    objc_setAssociatedObject(self, ASSOCIATION_PARALLEL_PROCCESS, [NSNumber numberWithBool:parallelProccess], OBJC_ASSOCIATION_ASSIGN);
}

-(BOOL) parallelProccess
{
    NSNumber* n = objc_getAssociatedObject(self, ASSOCIATION_PARALLEL_PROCCESS);
    return n.boolValue;
}

-(void) setRequestIndex:(int)requestIndex
{
    objc_setAssociatedObject(self, ASSOCIATION_REQUEST_INDEX, [NSNumber numberWithInt:requestIndex], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

-(int) requestIndex
{
    NSNumber* n = objc_getAssociatedObject(self, ASSOCIATION_REQUEST_INDEX);
    return n.intValue;
}
@end
